<template>
  <div class="fastNavControl">
    <div class="control-section">
      <div class="control-header">
        <span>当前状态</span>
      </div>
      <div class="control-body">
        <div class="control-item">
          <div class="control-title">模板样式</div>
          <div class="control-content">
            <div class="example-list">
              <div
                :class="['example-item', params.style == 1 ? 'choose' : '']"
                @click.stop="params.style = 1"
              >
                <img src="@/assets/images/diy/nav_icon_one.png" alt="" />
              </div>
              <div
                :class="['example-item', params.style == 2 ? 'choose' : '']"
                @click.stop="params.style = 2"
              >
                <img src="@/assets/images/diy/nav_icon_two.png" alt="" />
              </div>
            </div>
          </div>
        </div>
        <!-- 字体配置 -->
        <fontControl
          :fontData.sync="params.css"
          :showAlign="false"
          @resetFontCss="resetFontCss"
        ></fontControl>
        <colorControl
          :color.sync="params.lineColor"
          :title="'线条颜色'"
          @reset="params.lineColor = '#ffffff'"
          @change="
            (e) => {
              params.lineColor = e;
            }
          "
          v-if="params.style == 1"
        ></colorControl>
        <colorControl
          :color.sync="params.backgroundColor"
          :title="'背景颜色'"
          @reset="params.backgroundColor = '#c2b3b3'"
          @change="
            (e) => {
              params.backgroundColor = e;
            }
          "
          v-if="params.style == 2"
        ></colorControl>
      </div>
    </div>
  </div>
</template>


<script>
import { defaultCss } from "@/components/DiyNew/diy/dataConfig/config.js";
import fontControl from "@/components/DiyNew/diy/baseControl/fontControl/index.vue";
import colorControl from "@/components/DiyNew/diy/baseControl/colorControl/index.vue";
export default {
  name: "fastNavCurrentControl",
  components: {
    fontControl,
    colorControl,
  },
  props: {
    params: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {};
  },
  methods: {
    resetFontCss() {
      this.$set(this.params, "css", defaultCss);
    },
    resetLine() {
      this.$set(this.params, "lineColor", "#fa2c1b");
    },
  },
};
</script>


<style lang="scss" scoped>
.control-section {
  width: 100%;
  margin: 0 auto;
  text-align: center;
  .control-header {
    width: 100%;
    height: 48px;
    background: #ffffff;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    span:first-child {
      font-weight: 600;
      color: #000000;
    }
  }
  .control-body {
    width: 228px;
    margin: 0 auto;
  }
}
.control-item {
  width: 100%;
  .control-title {
    padding: 24px 0 14px 0;
    font-size: 12px;
    color: #000000;
    text-align: left;
  }
  .flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .reset {
    font-size: 12px;
    color: #9e9e9e;
    cursor: pointer;
  }
  .control-content {
    .example-list {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      .example-item {
        cursor: pointer;
        position: relative;
        width: 70px;
        height: 38px;
        background: #f6f7f9;
        border-radius: 4px;
        margin-right: 9px;
        display: flex;
        justify-content: center;
        align-items: center;
        img {
          width: 42px;
          height: 18px;
        }
      }
      .choose::before {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        border: 2px solid #1890fc;
        border-radius: 4px;
      }
      .example-item:nth-child(3n) {
        margin-right: 0;
      }
    }
  }
}
</style>